package org.xiaojl.modules.sys.entity;

import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;
import org.xiaojl.common.base.BaseEntity;
import org.xiaojl.utils.ToolUtil;

import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

/**
 * <p>
 * 系统用户
 * </p>
 *
 * @author xiaojl
 * @since 2017-08-18
 */
@TableName("sys_user")
public class SysUser extends BaseEntity<SysUser> {

    private static final long serialVersionUID = 1L;

    /**
     * 登陆名
     */
	private String loginName;
    /**
     * 用户名
     */
	private String realName;
    /**
     * 密码
     */
	private String loginPwd;
    /**
     * 性别：0-未知，1-男，2-女
     */
	private Integer sex;
    /**
     * 出生日期
     */
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date birthday;
    /**
     * 手机号
     */
	private String phone;
    /**
     * 用户状态：0-启用，1-禁用
     */
	private Integer status;
    /**
     * 备注
     */
	private String remark;
	
	/**
	 * 加密参数
	 */
	private String salt;

	@Override
	public Wrapper<SysUser> bindingQueryWrapper() {
		Wrapper<SysUser> wrapper = new EntityWrapper<SysUser>();
		if(ToolUtil.isNotEmpty(this.loginName)){
			wrapper.like("loginName", this.loginName);
		}
		if(ToolUtil.isNotEmpty(this.realName)){
			wrapper.like("realName", this.realName);
		}
		if(ToolUtil.isNotEmpty(this.loginPwd)){
			wrapper.like("loginPwd", this.loginPwd);
		}
		if(ToolUtil.isNotEmpty(this.sex)){
			wrapper.eq("sex", this.sex);
		}
		if(ToolUtil.isNotEmpty(this.phone)){
			wrapper.like("phone", this.phone);
		}
		if(ToolUtil.isNotEmpty(this.status)){
			wrapper.eq("status", this.status);
		}
		if(ToolUtil.isNotEmpty(this.remark)){
			wrapper.like("remark", this.remark);
		}
		if(ToolUtil.isNotEmpty(this.salt)){
			wrapper.like("salt", this.salt);
		}
		return wrapper;
	}


	public String getSalt() {
		return salt;
	}
	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getLoginPwd() {
		return loginPwd;
	}

	public void setLoginPwd(String loginPwd) {
		this.loginPwd = loginPwd;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

}
